﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminSite.Master"
    Inherits="System.Web.Mvc.ViewPage<IEnumerable<HYBYSoft.Company.Models.Links>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#startTime").attr("readonly", "true").datepicker({ dateFormat: 'yy-mm-dd',
                dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
                dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
            });

            $("#endTime").attr("readonly", "true").datepicker({ dateFormat: 'yy-mm-dd',
                dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
                dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
            });
        });
    </script>
    <div id="content">
        <div id="div_search">
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <tr>
                    <td id="left_search">
                    </td>
                    <td id="bg_search">
                        <p>
                            <span id="sitemap">当前位置：友情链接列表</span>
                        </p>
                        <%using (Html.BeginForm("Search", "Links"))
                          {%>
                        <p>
                            友情链接：<%=Html.TextBox("linkTitle"
                                                            , null
                                                            , new { style = "width:110px;margin-right:15px" })%>
                            起始时间：<%=Html.TextBox("startTime"
                                                        , null
                                                        , new { style = "width:110px;margin-right:15px" })%>
                            截止时间：<%=Html.TextBox("endTime"
                                                        , null
                                                        , new { style = "width:110px;margin-right:15px" })%>
                            <input type="submit" value="查询" />
                        </p>
                        <%} %>
                    </td>
                    <td id="right_search">
                    </td>
                </tr>
            </table>
        </div>
        <div id="div_list">
            <%if (Model.Count() == 0)
              {
                  Html.RenderPartial("partialNoneDate");
              }
              else
              {%>
            <% var grid = new WebGrid(source: Model, defaultSort: "LastEditTime", rowsPerPage: 10, canSort: false); %>
            <div id="divGrid">
                <%=grid.GetHtml(tableStyle: "grid"
                            , headerStyle: "header"
                            , rowStyle: "row"
                            , alternatingRowStyle: "alt"
                            , footerStyle: "footer"
                            , mode: WebGridPagerModes.All
                            , firstText: "首页"
                            , previousText: "上一页"
                            , nextText: "下一页"
                            , lastText: "尾页"
                            , numericLinksCount: 10
                            , columns: grid.Columns(
                                                                                                              grid.Column("链接标题", format: (item) => Html.ActionLink(item.Title.Length > 20 ? ((Links)item.Value).Title.Substring(0, 20) + "..." : ((Links)item.Value).Title, "Details", new { id = item.LinkID, pageId = Request.QueryString["page"] }), style: "datecolumn"),
                                                        grid.Column("链接地址" , format:(item)=> Html.Raw(string.Format("<a href='{0}' target='_blank'>{0}</a>",item.Url)),  style: "datecolumn"),
                                                        grid.Column("图标", format: (item) =>string.IsNullOrEmpty(item.Icon)? "":Html.Raw("<img src='/UplodeImages/" +item.Icon + "' height='18' width='18' />"), style: "imagecolumn"),
                                                        grid.Column("Creator", "创建者", style: "datecolumn"),
                                                        grid.Column("CreateTime", "创建时间", style: "datecolumn"),
                                                        //grid.Column("Editor", "修改者", style: "datecolumn"),
                                                        //grid.Column("LastEditTime", "最后修改时间", style: "datecolumn"),
                                                                                            grid.Column("编辑", format: (item) => Html.ActionLink("编辑", "Edit", new { id = item.LinkID, pageId = Request.QueryString["page"] }), style: "buttoncolumn"),
                                                        grid.Column("删除", format: (item) => Html.ActionLink("删除", "Delete", new { id = item.LinkID }, new { onclick = "return confirm('确定删除该友情链接？');" }), style: "buttoncolumn"),
                                                                                                              grid.Column("首页显示控制", format: (item) => Html.ActionLink(item.IsShow == 0 ? "显示" : "取消显示", "IndexShow", new { id = item.LinkID }, new { onclick = "return confirm('是否确定此操作？');" }), style: "buttoncolumn")
                                                        ))%>
                <%} %>
            </div>
        </div>
        <div id="div_button" style="padding-top: 165px">
            <p>
                <%: Html.ActionLink("添加新链接", "Create")%>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <%: Html.ActionLink("友情链接首页显示顺序", "Short")%>
            </p>
        </div>
    </div>
</asp:Content>
